/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sunspotworld;

import com.sun.spot.core.util.Utils;
import java.util.Random;

/**
 *
 * @author me
 */
public abstract class MyThread extends Thread {
    private boolean running=true;
    private Random rand = new Random();
    
    public void run() {
        while (running) {
            doStuff();
            Utils.sleep(rand.nextInt(StartApplication.MAX_SLEEP_TIME));
        }
    }
    
    protected abstract void doStuff();
    
    public void stopRunning() {
        running = false;
    }
}
